package com.shushan.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ViewGroup;

import com.android.common.ui.banner.Banner;
import com.android.common.ui.indicator.ViewPagerIndicator;
import com.shushan.util.DensityUtil;

/**
 * @ClassName: HomeBanner
 * @Desciption: //TODO
 * @author: yichaohua
 * @date: 2018-12-11
 */
public class HomeBanner extends Banner{

    private static final String TAG = "HomeBanner";

    public HomeBanner(Context context) {
        super(context);

        ViewGroup.LayoutParams layoutParams = viewPager.getLayoutParams();
        layoutParams.width = DensityUtil.dip2px(context,338);
        viewPager.setLayoutParams(layoutParams);
    }

    public HomeBanner(Context context, AttributeSet attrs) {
        super(context, attrs);

        ViewGroup.LayoutParams layoutParams = viewPager.getLayoutParams();
        layoutParams.width = DensityUtil.dip2px(context,338);
        viewPager.setLayoutParams(layoutParams);
    }

    public HomeBanner(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        ViewGroup.LayoutParams layoutParams = viewPager.getLayoutParams();
        layoutParams.width = DensityUtil.dip2px(context,338);
        viewPager.setLayoutParams(layoutParams);
    }

    public void setIndicator(ViewPagerIndicator viewPagerIndicator){
        if(viewPagerIndicator != null){
            viewPagerIndicator.setViewPager(viewPager);
        }
    }

    public void setIndicator(ViewPagerIndicator viewPagerIndicator,int CycleNumber){
        if(viewPagerIndicator != null){
            viewPagerIndicator.setViewPager(viewPager,CycleNumber);
        }
    }
}
